package com.zhongying.jf.util.check;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;

/**
 * 对账工具类
 */
public class CheckUtil {
    public static void detailTransform(Map map) {

        if (map.get("dzStaus") != null) {
            switch (map.get("dzStaus").toString()) {
                case "1":
                    map.put("dzStaus", "对账成功");
                    break;
                case "2":
                    map.put("dzStaus", "信息不等");
                    break;
                case "3":
                    map.put("dzStaus", "我方单边");
                    break;
                case "4":
                    map.put("dzStaus", "第三方单边");
                    break;
            }
        }

        if (map.get("meddleStatusBefore") != null) {
            switch (map.get("meddleStatusBefore").toString()) {
                case "1":
                    map.put("meddleStatusBefore", "对账成功");
                    break;
                case "2":
                    map.put("meddleStatusBefore", "信息不等");
                    break;
                case "3":
                    map.put("meddleStatusBefore", "我方单边");
                    break;
                case "4":
                    map.put("meddleStatusBefore", "第三方单边");
                    break;
            }
        }

        if (map.get("meddleStatus") != null) {
            switch (map.get("meddleStatus").toString()) {
                case "0":
                    map.put("meddleStatus", "");
                    break;
                case "1":
                    map.put("meddleStatus", "未干涉");
                    break;
                case "2":
                    map.put("meddleStatus", "已干涉");
                    break;
            }
        }
        SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat formatTime = new SimpleDateFormat("yyyy-MM-dd");
        String time = null;
        if (map.get("createTime") != null) {
            try {

                time = formatTime.format(formatDate.parse(map.get("createTime").toString()));
            } catch (ParseException e) {
                e.printStackTrace();
            }
            map.put("createTime", time);
        }
    }


    public static void detailTransformForUser(Map map) {
        CheckUtil.detailTransform(map);

        if (map.get("dzStatus") != null) {
            switch (map.get("dzStatus").toString()) {
                case "1":
                    map.put("dzStatus", "对账成功");
                    break;
                case "2":
                    map.put("dzStatus", "信息不等");
                    break;
                case "3":
                    map.put("dzStatus", "我方单边");
                    break;
                case "4":
                    map.put("dzStatus", "第三方单边");
                    break;
            }
        }

        if (map.get("result") != null) {
            switch (map.get("result").toString()) {
                case "1":
                    map.put("result", "异常");
                    break;
                case "0":
                    map.put("result", "正常");
                    break;
            }
        }

        if (map.get("meddleStatusBefore") != null) {
            switch (map.get("meddleStatusBefore").toString()) {
                case "0":
                    map.put("meddleStatusBefore", "无需干涉");
                    break;
                case "1":
                    map.put("meddleStatusBefore", "未干涉");
                    break;
                case "2":
                    map.put("meddleStatusBefore", "已干涉");
                    break;
            }
        }
        if (map.get("ourAuthTypeFormat") != null) {
            switch (map.get("ourAuthTypeFormat").toString()) {
                case "1":
                    map.put("ourAuthTypeFormat", "开户");
                    break;
                case "2":
                    map.put("ourAuthTypeFormat", "绑卡");
                    break;
            }
        }
        if (map.get("ourStatus") != null) {
            switch (map.get("ourStatus").toString()) {
                case "1":
                    map.put("ourStatus", "未开户");
                    break;
                case "2":
                    map.put("ourStatus", "开户成功");
                    break;
                case "3":
                    map.put("ourStatus", "开户失败");
                    break;
                case "4":
                    map.put("ourStatus", "开户处理中");
                    break;
                case "5":
                    map.put("ourStatus", "开户异常");
                    break;
            }
        }
        if (map.get("thirdAuthType") != null) {
            switch (map.get("thirdAuthType").toString()) {
                case "1":
                    map.put("thirdAuthType", "个人注册");
                    break;
                case "2":
                    map.put("thirdAuthType", "存量激活");
                    break;
                case "3":
                    map.put("thirdAuthType", "个人绑卡");
                    break;
                case "4":
                    map.put("thirdAuthType", "预留手机号");
                    break;
                case "5":
                    map.put("thirdAuthType", "快捷充值鉴权");
                    break;
                case "6":
                    map.put("thirdAuthType", "批量鉴权");
                    break;
                case "7":
                    map.put("thirdAuthType", "委托开户");
                    break;
                case "8":
                    map.put("thirdAuthType", "银行卡鉴权");
                    break;
            }
        }
        if (map.get("thirdStatus") != null) {
            switch (map.get("thirdStatus").toString()) {
                case "0":
                    map.put("thirdStatus", "成功");
                    break;
                case "1":
                    map.put("thirdStatus", "失败");
                    break;


            }
        }

        if (map.get("ourIdnoType") != null) {
            switch (map.get("ourIdnoType").toString()) {
                case "101":
                    map.put("ourIdnoType", "身份证");
                    break;
                case "102":
                    map.put("ourIdnoType", "护照");
                    break;
                case "103":
                    map.put("ourIdnoType", "港澳台通信证");
                    break;
                case "104":
                    map.put("ourIdnoType", "外国人永久居留证");
                    break;


            }
        }

        if (map.get("thirdIdnoType") != null) {
            switch (map.get("thirdIdnoType").toString()) {
                case "1":
                    map.put("thirdIdnoType", "身份证");
                    break;
                case "7":
                    map.put("thirdIdnoType", "护照");
                    break;
                case "8":
                    map.put("thirdIdnoType", "港澳台通信证");
                    break;
                case "17":
                    map.put("thirdIdnoType", "外国人永久居留证");
                    break;


            }
        }

        if (map.get("thirdUserType") != null) {
            switch (map.get("thirdUserType").toString()) {
                case "1":
                    map.put("thirdUserType", "个人");
                    break;
                case "2":
                    map.put("thirdUserType", "企业");
                    break;
            }
        }
        if (map.get("thirdUserRole") != null) {
            switch (map.get("thirdUserRole").toString()) {
                case "1":
                    map.put("thirdUserRole", "普通用户");
                    break;
                case "2":
                    map.put("thirdUserRole", "担保方");
                    break;
                case "3":
                    map.put("thirdUserRole", "平台");
                    break;
                case "4":
                    map.put("thirdUserRole", "投资人");
                    break;
                case "5":
                    map.put("thirdUserRole", "借款人");
                    break;
                case "6":
                    map.put("thirdUserRole", "居间人");
                    break;
                case "7":
                    map.put("thirdUserRole", "合作机构");
                    break;
                case "8":
                    map.put("thirdUserRole", "供应商");
                    break;
                case "10":
                    map.put("thirdUserRole", "委托借款人");
                    break;

            }
        }

        if (map.get("ourUserRole") != null) {
            switch (map.get("ourUserRole").toString()) {
                case "0":
                    map.put("ourUserRole", "一般投资人");
                    break;
                case "1":
                    map.put("ourUserRole", "一般借款人");
                    break;
                case "2":
                    map.put("ourUserRole", "企业投资人");
                    break;
                case "3":
                    map.put("ourUserRole", "企业借款人");
                    break;
                case "4":
                    map.put("ourUserRole", "超级放款人");
                    break;
                case "5":
                    map.put("ourUserRole", "担保机构");
                    break;
                case "6":
                    map.put("ourUserRole", "合作机构");
                    break;
                case "7":
                    map.put("ourUserRole", "供应商");
                    break;
                case "8":
                    map.put("ourUserRole", "居间人");
                    break;


            }
        }

    }

}
